# 本校序列
data = {
            'name':'重庆对外经贸学院',
            'professionals':[
                {'name':'经济学'},
                {'name': '金融工程'},
                {'name': '保险学'},
                {'name': '投资学'},
                {'name': '国际经济与贸易'},
                {'name':'贸易经济'},
                {'name': '休闲体育'},
                {'name': '学前教育'},
                {'name': '汉语言文学'},
                {'name': '汉语国际教育'},
                {'name': '英语'},
                {'name': '日语'},
                {'name': '翻译'},
                {'name': '商务英语'},
                {'name': '新闻学'},
                {'name': '网络与新媒体'},
                {'name': '数学与应用数学'},
                {'name': '人文地理与城乡规划'},
                {'name': '应用统计学'},
                {'name': '电子科学与技术'},
                {'name': '计算机科学与技术'},
                {'name': '物联网工程'},
                {'name': '数字媒体技术'},
                {'name': '数据科学与大数据技术'},
                {'name': '信息管理与信息系统'},
                {'name': '市场营销'},
                {'name': '财务管理'},
                {'name': '人力资源管理'},
                {'name': '审计学'},
                {'name': '物业管理'},
                {'name': '健康服务与管理'},
                {'name': '物流管理'},
                {'name': '电子商务'},
                {'name': '旅游管理'},
                {'name': '音乐表演'},
                {'name': '舞蹈表演'},
                {'name': '表演'},
                {'name': '广播电视编导'},
                {'name': '戏剧影视美术设计'},
                {'name': '播音与主持艺术'},
                {'name': '视觉传达设计'},
                {'name': '环境设计'},
                {'name': '产品设计'},
                {'name': '会计电算化'},
                {'name': '财务管理'},
                {'name': '艺术设计'},
                {'name': '应用英语'},
            ]
        }


#


# 全国高校信息注入代码
    # filepath = r'C:\Users\16931\Documents\XiaoMiNet\Upupoo\Docker\config\folder\wxApp项目\wxAppBackend-new\backend\API\utils\newdata.json'
    # with open(file=filepath, mode='r', encoding='utf-8') as readStream:
    #     shoolInfo = json.load(readStream)
    #
    # for school in list(shoolInfo.items()):
    #     prolist = []
    #     for key, value in school[1].items():
    #         prolist.extend(value)
    #
    #     newprofList = []
    #     for item in prolist:
    #         d = {}
    #         d['name'] = item
    #         newprofList.append(d)
    #
    #     data = {
    #         'name': school[0],
    #         'professionals': newprofList
    #     }
    #
    #     # # 1. 新建大学记录
    #     university = University.objects.get_or_create(name=data['name'])[0]
    #     # 2. 获取该大学所设专业,并遍历获取记录
    #     professionals = data['professionals']
    #     professionals_obj_list = []
    #     for one in professionals:
    #         major = Professional.objects.get_or_create(name=one['name'])[0]
    #         professionals_obj_list.append(major)
    #
    #         #     # 3.所有专业与该大学关联
    #         university.professionals.add(major)
    #     print(professionals_obj_list)